<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <title>我的资料</title>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <style type="text/css">
        .head-img {
            width: 180px;
            height: 180px;
            border-radius: 50%;
        }

        .mui-card-content {
            padding-top: 50px;
            padding-bottom: 50px;
            font-size: 20px;
        }

        .mui-input-row label {
            width: 40%;
        }

        .mui-input-row div {
            font-family: 'Helvetica Neue', Helvetica, sans-serif;
            line-height: 1.1;
            padding: 11px 15px;
        }
    </style>
</head>
<body>
<div class="mui-content">
    <div class="mui-card">
        <div class="mui-card-header">
            <div class="mui-text-center" style="width: 100%;">
                <img id="headimgurl" src="img/bg-01.jpg" class="head-img"/>
            </div>
        </div>
        <div class="mui-card-content">
            <div class="mui-input-row">
                <label>客户名称：</label>
                <div id="name">XXX</div>
            </div>
            <div id="house" style="display: none">
                <div class="mui-input-row">
                    <label>认筹号：</label>
                    <div id="phone">135XXXXXXXX</div>
                </div>
                <div class="mui-input-row">
                    <label>成交单位：</label>
                    <div id="roomNo">XXXX</div>
                </div>
                <div class="mui-input-row">
                    <label>销控时间：</label>
                    <div id="salesTime">0000-00-00 00:00:00</div>
                </div>
            </div>
            <div class="mui-input-row mui-text-center togo" style="display: none">
                您还未认筹房产！<a href="house.html">去认筹</a>
            </div>
        </div>
    </div>
    <nav class="mui-bar mui-bar-tab">
        <a class="mui-tab-item" href="house.html">
            <span class="mui-icon mui-icon-home"></span>
            <span class="mui-tab-label">房源</span>
        </a>
        <a class="mui-tab-item" href="favorite.html">
            <span class="mui-icon mui-icon-email"></span>
            <span class="mui-tab-label">收藏</span>
        </a>
        <a class="mui-tab-item mui-active" href="me.html">
            <span class="mui-icon mui-icon-person"></span>
            <span class="mui-tab-label">我的</span>
        </a>
    </nav>
</div>
<script src="js/mui.min.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/app.js"></script>
<script type="application/javascript">
    mui.init({})
    goUrl('.mui-bar .mui-tab-item', function (that) {
        return that.getAttribute('href')
    })
    goUrl('.togo>a', function (that) {
        return that.getAttribute('href')
    })
    mui.ready(function () {
        ajax('/rest/house/getMine', {
            type: 'GET',
            success: function (data) {
                var user = data.user
                var house = data.house
                mui('#name')[0].innerText = user.name || '未知'
                mui('#headimgurl')[0].setAttribute('src', user.headimgurl || 'img/bg-01.jpg')
                if (house) {
                    mui('#phone')[0].innerText = user.phone
                    mui('#roomNo')[0].innerText = house.roomNo
                    mui('#salesTime')[0].innerText = moment(house.salesTime).format('YYYY-MM-DD HH:mm:ss')
                    mui('#house')[0].style.display = 'block'
                } else {
                    mui('.togo')[0].style.display = 'block'
                }
            }
        })
    })
</script>
</body>
</html>